PATTERN_PATH=/mnt/e/project-pattern/
# 安装
 if [[ -z "$(docker images -q seataio/seata-server:latest 2> /dev/null)" ]]; then
    docker pull seataio/seata-server:1.4.1
 else
    echo "seata-server installed"
  fi
#	运行
  if [[ -z "$(docker ps -aqf "name=seata-pattern")" ]]; then
      mkdir -p /opt/seata/logs
      # 修改对应 nacos配置 namespace:pattern  的config.txt   mysql改成对应的docker:ip地址
    	docker run --name seata-pattern -d \
    	--add-host=project-pattern:192.168.0.101 \
      -e SEATA_PORT=8091 \
      -v /opt/seata/logs:/root/logs \
      --privileged=true --restart=always \
      -p 8091:8091 \
       seataio/seata-server:1.4.1
    # 进入容器
      docker cp $PATTERN_PATH/.environment/init/docker/seata/registry.conf seata-pattern:/opt/
      docker exec -it seata-pattern /bin/sh -c "\cp -r /opt/registry.conf /seata-server/resources/"
    #重启
      docker restart seata-pattern
  else
      echo "seata-pattern running"
  fi
